package com.yunqiao.service.api.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yunqiao.common.utils.PageUtils;
import com.yunqiao.common.utils.Query;
import com.yunqiao.service.api.ProtocolService;
import com.yunqiao.service.api.entity.ProtocolEntity;
import com.yunqiao.service.api.mapper.ProtocolMapper;
import org.springframework.stereotype.Service;

import java.util.Map;


@Service("protocolService")
public class ProtocolServiceImpl extends ServiceImpl<ProtocolMapper, ProtocolEntity> implements ProtocolService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        //各种查询条件的过滤,在此进行
        QueryWrapper<ProtocolEntity> queryWrapper = new QueryWrapper<>();
        //类型
        if (params.get("type") != null) {
            queryWrapper.eq("type", params.get("type"));
        }
        IPage<ProtocolEntity> page = this.page(new Query<ProtocolEntity>(params).getPage(), queryWrapper);
        return new PageUtils(page);
    }


}
